package cn.lianxi.mrv2._05_;

import java.io.IOException;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

// S01 75.5 <{"S01", 75.5} , 75.5>
// S01 45.5 <{"S01", 45.5} , 45.5>

public class TokenizerMapper extends
		Mapper<LongWritable, Text, ExpenseAccountWritable, Text> {

	ExpenseAccountWritable eaw = new ExpenseAccountWritable();

	@Override
	protected void map(LongWritable key, Text value, Context context)
			throws IOException, InterruptedException {
		String[] fields = value.toString().split("\t");
		eaw.set(fields[0], Double.parseDouble(fields[3]));
		context.write(eaw, value);
	}
}
